package com.bot.nft.module.dc.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bot.common.pojo.CommonResult;
import com.bot.nft.module.dc.domain.bo.SellQueryBo;
import com.bot.nft.module.dc.domain.vo.SellGetInfoVo;
import com.bot.nft.module.dc.domain.vo.SellOrdPayLogVo;
import com.bot.nft.module.dc.domain.vo.SellPoInfoVo;
import com.bot.nft.module.dc.service.IDcSellOrderInfoService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author RenXiaoZheng
 * @since 2024-01-24
 */
@RestController
@RequestMapping("/conOrd")
@CrossOrigin
public class DcSellOrderInfoController {

    @Resource
    public IDcSellOrderInfoService iDcOrderInfoService;

    /**
     * 分页查询寄售订单
     *
     * @param sellQueryBo 状态
     * @param pageNo      页码
     * @param pageSize    每页条数
     * @return
     */
    @PostMapping("/{pageNo}/{pageSize}/query.do")
    public CommonResult<Page<SellPoInfoVo>> querySellPo(@RequestBody SellQueryBo sellQueryBo, @PathVariable("pageNo") Integer pageNo, @PathVariable("pageSize") Integer pageSize) {
        Page<SellPoInfoVo> sellPoInfoVo = iDcOrderInfoService.querySellPo(sellQueryBo.getStatus(), sellQueryBo.getPhone(), pageNo, pageSize);
        //把查出来的数据放入统一格式中
        CommonResult<Page<SellPoInfoVo>> data = CommonResult.data(sellPoInfoVo);
        //返回数据
        return data;
    }
    /**
     * 查看寄售订单信息
     *
     * @param id 订单信息标识
     * @return
     */
    @GetMapping("/{id}/getSell.do")
    public CommonResult<SellGetInfoVo> getSellPo(@PathVariable("id") String id) {
        SellGetInfoVo sellPo = iDcOrderInfoService.getSellPo(id);
        //把查出来的数据放入统一格式中
        CommonResult<SellGetInfoVo> data = CommonResult.data(sellPo);
        //返回数据
        return data;
    }
    /**
     * 查看支付信息
     */
    @GetMapping("/{id}/getSellOrder.do")
    public CommonResult<List<SellOrdPayLogVo>> getSellOrder(@PathVariable("id") String id) {
        List<SellOrdPayLogVo> sellOrder = iDcOrderInfoService.getSellOrder(id);
        return CommonResult.data(sellOrder);
    }

}
